import qs from 'qs'
//引入封装好的地址
import request from "@/request/request.js"

//短信验证码 params{phone:16674324325} 
export const SendSMSAPI = (params) => request.post("/sendSMS", qs.stringify(params))
//手机号码验证登录 
export const PhoneReginAPI = (params) => request.post("/phoneRegin", qs.stringify(params))

//获取用户信息  根据token值获取所以不需要携带参数
export const UserProfilesAPI = () => request.get("/shop/userProfiles")

//微信扫码登录 
export const WeixinLoginAPI = (params) => request.post("/wechatUsers/PCLogin", qs.stringify(params))

//手机绑定微信 /wechatUsers/binding
export const BindingAPI = (params) => request.post("/wechatUsers/binding", qs.stringify(params))

// 首页精品推荐请求JingPinAPI
export const JingPinAPI = () => request.get("/products/recommend");
// 请求热门兑换的数据ReMenAPI
export const ReMenAPI = () => request.get("/products/hot");

//根据id获取详情页内容  /products/90
export const GoodsDetailsAPI = (id) => request.get(`/products/${id}`)

// 加入购物车
export const AddCartsAPI = (payload) =>
    request.post('/shop/carts/add', qs.stringify(payload));

//商品搜索 /products
export const GoodsSearchAPI = (params) => request.get("/products", { params })

//查看购物车 /shop/carts
export const CartDataAPI = () => request.get("/shop/carts")

//删除购物车商品 
export const DelGoodsAPI = (id) => request.delete(`/shop/carts?productIds=${id}`)